package controllers

import (
	"beesss/models"
	beego "github.com/beego/beego/v2/server/web"
)

type CkControllers struct {
	beego.Controller
}

func (c *CkControllers) Add() {
	name := c.GetString("name")
	address := c.GetString("address")
	var ck = models.Ck{
		Name:    name,
		Address: address,
	}
	if name == "" || address == "" {
		c.Data["json"] = map[string]interface{}{
			"code": 203,
			"msg":  "参数为空",
		}
		c.ServeJSON()
	}
	models.DB.Create(&ck)
	c.Data["json"] = map[string]interface{}{
		"code": 200,
		"Msg":  "添加成功",
	}
	c.ServeJSON()
}
